<!-- 优惠券 -->
 <script lang="ts">
 export default {
   name: "discountCouponList",
 };
 </script>
 <template>
   <div class="page-box h100 display-flex czbj">
     <p class="title-label mb10">
      优惠券
     </p>
     <div>
       <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
         sonRouter="discountCouponadd"></dxtable>
     </div>
   </div>

 </template>
 <script lang='ts' setup>
 import dxtable from "../../../components/util/dxtable.vue";
 import sort from "../../../components/util/sort.vue";
 import { dxget, dxpost, qurl, hf } from "../../../util/index";
 import { h, ref, reactive, onBeforeUpdate } from "vue";
 const props = defineProps({
   pup: { type: String },
 });
 const showModal = ref(false)
 const qcosertt = ref()
 let portUrl = "yuyue/discountCoupon";
 let headBtn = [];
 const zdList = ref()
 const databale = ref();
 const videourl = ref()
 const typeli = ref([])
 const initeer = () => {
   databale.value.initDataExpose();
 };
 const emit = defineEmits(["callBack"]);
 // 弹窗公用该列表
 let dataJson = reactive([
   {
     title: "id",
     key: "id",
     width: 50,
   },
 
   {
     title: "名称",
     search: true, // 是否在搜索栏展示
     key: "name",
     width: 400,
   },  {
     title: "面值",
     search: true, // 是否在搜索栏展示
     key: "couponFaceValue",
   },{
     title: "使用门槛",
     key: "mkval",
     render:(row)=>{
        if(row.mkval==0){
          return "无门槛"
        }else{
          return  '满'+row.mkval+'元可用'
        }
     }
   },{
     title: "状态",
     key: "state",
     render:(row)=>{
      if(row.state==1){
          return "开启"
        }else{
          return  '关闭'
        }
     }
   },
   
 
   {
     title: "排序",
     width: 100,
     render(row) {
       row.databaseName = "discountCouponList";
       return h(sort, {
         row,
         onCallBack: () => {
           initeer();
         },
       });
     },
   },
   {
     title: "添加时间",
     key: "addTime",
     width: "140",
     type: "daterange",
   },
 ]);
 
 const qx = {
   DeletePermissionID: "discountCouponListdel", //删除
   EditPermissionIdentifier: "discountCouponListbj", // 编辑
   NewPermissionIdentifier: "discountCouponListxz", // 新建
   ViewPermissionID: "discountCouponListck", // 查看
 };
 const getcasetype = async () => {
   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'yyzjfl' })
 
   dataJson[5].options = [
     {
       label: "全部",
       value: ""
     },
     ...data
   ]
   typeli.value = data
   // ishjwoer.value = true
 }
 getcasetype()
 
 </script>
 <style scoped>
 .fsdfereertr{
   width: 100%;
   height: 360px;
 }
 </style>
   
   
   